package com.xiyoukt.springboot.jpa;

import com.xiyoukt.springboot.User;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface UserRepository extends JpaRepository<User, Long> {

//    @Modifying
    @Query(value = "select * from user u where u.gender=:gender", nativeQuery = true)
    List<User> getUserByGender(@Param("gender") Integer gender, Pageable pageable);

    List<User> findUserByGender(Integer gender, Pageable pageable);
//    List<User> findFirstByAgeAnAndAge(Integer gender, Pageable pageable);

    // genderAndAge, gender, age
//    List<User> findUserByGenderAnd_Age(Integer gender, Pageable pageable);

}
